home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / ClipNotes.1.0 / Source / Text_more.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  83 lines

  1. /* Text_more.m                 
  2.  *
  3.  * This category makes dealing with the Text object easier. 
  4.  * See the docu for details.
  5.  *
  6.  * For interface-info see the header file. The comments in this file mostly
  7.  * cover only the real implementation details.
  8.  *
  9.  * Written by:         Thomas Engel
  10.  * Created:            30.01.1995 (Copyleft)
  11.  * Last modified:     30.01.1995
  12.  */
  13.  
  14. // The following define is a fake. Looks like NeXT...but it is a cheatmode
  15. // action.
  16. // We don't have a RTFD paste type. But I really need one !
  17.  
  18. #define NXRTFDPboardType NXUniqueString("NeXT RTFD pasteboard type")
  19.  
  20.  
  21. #import "Text_more.h"
  22.  
  23. @implementation Text(More)
  24.  
  25. - copyTo:aPasteboard
  26. {
  27.     NXAtom textTypes[5];
  28.  
  29.     if( [self isMonoFont] )
  30.     {
  31.         textTypes[0] = NXAsciiPboardType;
  32.         textTypes[1] = NULL;
  33.     }
  34.     // In the other case we will cheat. The RTFD type was NEVER defined by
  35.     // NeXT. But we will use it...it works. (see the define)
  36.  
  37.     else
  38.     {
  39.         textTypes[0] = NXRTFDPboardType;
  40.         textTypes[1] = NXTIFFPboardType;
  41.         textTypes[2] = NXRTFPboardType;
  42.         textTypes[3] = NXAsciiPboardType;
  43.         textTypes[4] = NULL;
  44.     }
  45.     [self writeSelectionToPasteboard:aPasteboard types:textTypes];
  46.     return self;
  47. }
  48.  
  49. - cutTo:aPasteboard
  50. {
  51.     [self copyTo:aPasteboard];
  52.     [self delete:self];
  53.     return self;
  54. }
  55.  
  56. - pasteFrom:aPasteboard
  57. {
  58.     [self readSelectionFromPasteboard:aPasteboard];
  59.     return self;
  60. }
  61.  
  62. - (BOOL)hasEmptySelection
  63. {
  64.     NXSelPt    start;
  65.     NXSelPt    end;
  66.  
  67.     [self getSel:&start :&end];
  68.     
  69.     if( start.cp == end.cp || 
  70.         start.cp < 0 )
  71.         return YES;
  72.     
  73.     return NO;
  74. }
  75.  
  76. @end
  77.  
  78. /*
  79.  * History: 30.01.95 Buh
  80.  *            
  81.  *
  82.  * Bugs: - ...
  83.  */